<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>MackDown文本编辑器保存数据库</title>
	<link rel="stylesheet" href="css/editormd.min.css" />
<style type="text/css">
*{margin:0;padding: 0}
.header{height:20px;width:100%;background: #ccc;}
.myfile{z-index: 100;position: relative;}
.myfile_title{color: #999;cursor: pointer;}
.myfile_menu{height: 100px;width: 100px;background: #f00;position: absolute;display: none;}
.myfile_title:hover+.myfile_menu{
    display: block;
}
</style>
</head>
<body style="height: 408px">
<div class="header">
    <div class="myfile">
        <span class="myfile_title"><a>我的文件</a></span>
        <div class="myfile_menu"></div>
    </div>
</div>	
<div class="main" style="height: 530px">
    <div id="editormd" style="height: 500px">
        <textarea style="display:none;" id="text">### Hello Editor.md !</textarea>
    </div>
</div>
<button id="submit">提交</button>
<script src="jquery.min.js"></script>
<script type="text/javascript">
    $("#submit").click(function(){
        var text=$("#text").val();
        $.ajax({
        type: "post",
        url: "submit",
        data: {"content":text},
        dataType:"JSON",
        success: function(data) {  
            if (data.status == 1) {
               alert('提交成功');
            }
            else if(data.status==2){
                alert(data.msg);
            }else if(data.status==3){
                alert(data.msg);
            } else {
               alert('提交失败');
            }
            
        }
});
    })
</script>
<script src="editormd.min.js"></script>
<script type="text/javascript">
    $(function() {
        var editor = editormd("editormd", {
            path : "./lib/" // Autoload modules mode, codemirror, marked... dependents libs path
        });

    });
</script>
</body>
</html>